var login = new Vue({
	
	 el: '#login',
	
	 data: {
         loginname: '',
         loginpassword: '',
         yzm:'',
		 sysTitle:getSysTitle()
     },
     
     created: function() {
    	 this.RelodeYzm();
		 document.title = this.sysTitle
     },
     computed: {
     },
     methods: {
     	login : function(){
     		if (!this.loginname){
     			layer.alert("请输入登录名！");
         		this.$refs.userName.focus();
         		return false;
         	} else if(!this.loginpassword) {
         		layer.alert("请输入密码！");
         		this.$refs.password.focus();
         		return false;
         	}
     		// else if (!this.yzm) {
         	// 	layer.alert("请输入验证码！");
         	// 	this.$refs.yzm.focus();
         	// 	return false;
			// }
               var _this=this;
		      $.post("/user/check_login",{
				    account : this.loginname,
				    password : this.loginpassword,
		    		yzm : this.yzm,
		    		rdm : Math.random()
		    	},function(ppData){
		    		var mmData = ppData;
		    		var result = mmData.result;
		    		var message = mmData.message;
		    		if(result == "1"){

		    			var data = mmData.resultContent;
		    			if(data.Type=="0"){
							location.href = "../../main/xiangmu";
						}else if(data.Type=="zj")
						{
							location.href = "../../vote/xiangmu";
						}
						else if(data.Type=="pt")
						{
							location.href = "../../main/operatorprint";
						}
		    			//
		    			
		    			
		    		}else{
		    			layer.alert(message);
		    			_this.RelodeYzm();
		    		}
		    	},"json");
     	},
     	
     	RelodeYzm :function(){
     		//document.getElementById("yzmimg").src = "/main/checkcode?v=" + Math.random();
     	}
     }
	
	
});